package com.xy.biz.ts.domain.converter;

import java.util.Collection;
import java.util.List;

import com.xy.biz.ts.domain.bo.ExaminationRecordQuestionBO;
import com.xy.biz.ts.domain.po.ExaminationRecordQuestionPO;
import com.xy.biz.ts.domain.query.ExaminationRecordQuestionQuery;
import com.xy.biz.ts.domain.resp.GetExaminationRecordQuestionResponse;
import com.xy.biz.ts.domain.req.SaveExaminationRecordQuestionRequest;
import com.xy.biz.ts.domain.req.ListExaminationRecordQuestionRequest;
import com.xy.tool.util.BeanUtilsEx;


/**
 *
 *
 * @author yzh
 * @date 2021-4-6
 */
public class ExaminationRecordQuestionConverter {

	public static ExaminationRecordQuestionPO toPO(ExaminationRecordQuestionBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new ExaminationRecordQuestionPO(), true);
	}

	public static List<ExaminationRecordQuestionPO> toPO(Collection<ExaminationRecordQuestionBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ExaminationRecordQuestionPO(), true);
	}

	public static ExaminationRecordQuestionBO fromPO(ExaminationRecordQuestionPO source) {
		return BeanUtilsEx.copyProperties(source, () -> new ExaminationRecordQuestionBO());
	}

	public static List<ExaminationRecordQuestionBO> fromPO(Collection<ExaminationRecordQuestionPO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ExaminationRecordQuestionBO());
	}

	public static ExaminationRecordQuestionBO toBO(SaveExaminationRecordQuestionRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new ExaminationRecordQuestionBO(), true);
	}

	public static List<ExaminationRecordQuestionBO> toBO(Collection<SaveExaminationRecordQuestionRequest> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ExaminationRecordQuestionBO(), true);
	}

	public static GetExaminationRecordQuestionResponse toResponse(ExaminationRecordQuestionBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new GetExaminationRecordQuestionResponse());
	}

	public static List<GetExaminationRecordQuestionResponse> toResponse(Collection<ExaminationRecordQuestionBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetExaminationRecordQuestionResponse());
	}

	public static ExaminationRecordQuestionQuery toQuery(ListExaminationRecordQuestionRequest source) {
		if(null == source) {
			return null;
		}
		ExaminationRecordQuestionQuery target = new ExaminationRecordQuestionQuery(source.getPageIndex(), source.getPageSize());
		BeanUtilsEx.copyProperties(source, target);
		return target;
	}

}
